package util;

public class ListNode {
      public int val;
      public ListNode next;
      public ListNode(int x) { val = x; }

      public static ListNode getListNode(int[] nums){
          ListNode pre = new ListNode(0);
          ListNode head = new ListNode(nums[0]);
          pre.next = head;
          for (int i = 1; i < nums.length; i++) {
              ListNode node = new ListNode(nums[i]);
              head.next = node;
              head = node;
          }
          return pre.next;
      }
  }